<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import=" java.util.List"%>
<%@ page import=" com.demo.entity.Orders"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>系统管理-订单管理</title>
<script type="text/javascript">
    function check() {
         alert("已支付，请勿重复支付 ! ");
         return false;
    }
</script>
</head>
<body>
<center>
    <fieldset>
        <legend style="color: #00f"> <h3>订单管理</h3> </legend>
        <table border="1">
            <tr>
                <th>订单编号</th>
                <th>下单用户</th>
                <th>订单费用</th>
                <th>收件人</th>
                <th>收件号码</th>
                <th>收件地址</th>
                <th>支付状态</th>
                <th>下单时间</th>
                <th>是否删除</th>
                <th>是否支付</th>
            </tr>

            <%
                List<Orders> ordersList = (ArrayList<Orders>) session.getAttribute("ordersInfo");
                for (Orders orders : ordersList) {
            %>
            <tr>
                <th><%=orders.getId()%></th>
                <th><%=orders.getUsername()%></th>
                <th><%=orders.getMoney()%></th>
                <th><%=orders.getReceiverName()%></th>
                <th><%=orders.getReceiverPhone()%></th>
                <th><%=orders.getReceiverAddress()%></th>
                
                <%int stateNum = orders.getPaystate();
                      if(stateNum == 1){ %>
                <th><font style="color: #00f">已支付</font></th>
                <%} else if(stateNum == 0){%>
                <th><font style="color: #f00">未支付</font></th>
                <%} %>
                
                <th><%=orders.getOrdertime()%></th>
                <th><a href="deleteOrderById/<%=orders.getId()%> ">删除</a></th>

                <%if(stateNum == 1){ %>
                <th><a href="#"  onclick="return check();">支付</a></th>
                <%} else if(stateNum == 0){%>
                <th><a href="updatePayOrdersByManage/<%=orders.getId() %>" >支付</a></th>
                <%} %>

            </tr>
            <%
                 } 
            %>
             <tr><th colspan="10" align="center"><a href="/WebStoreSSM/controller/adminOrder">添加订单</a>
                                                                                <a href="/WebStoreSSM/views/pageAdmin.jsp">返回系统管理</a></th></tr>
        </table>
    </fieldset>
</center>
</body>
</html>